--- @param extension Package
--- @param HY HY_Utility
--- @param U Utility
return function(extension, HY, U)
    local hy_aki_shizuha = General:new(extension, "hy_aki_shizuha", "ten_k", 3, 3, General.Female)

    local gloam_breath = fk.CreateSkill {
        name = "gloam_breath",
    }
    gloam_breath:addEffect("viewas", {
        mute_card = false,
        pattern = "indulgence",
        card_num = 1,
        card_filter = function(self, player, to_select, selected, selected_targets)
            if Fk:getCardById(to_select).suit ~= Card.Club then
                return false
            end
            return #selected < 1
        end,
        prompt = "gloam_breath_prompt",
        view_as = function(self, player, cards)
            if #cards ~= 1 then
                return
            end
            local card = Fk:cloneCard("indulgence")
            card:addSubcards(cards)
            return card
        end,
        after_use = function(self, player, use)
            local room = player.room
            local cards = table.filter(room.discard_pile, function(id)
                return Fk:getCardById(id).color == Card.Red
            end)
            if #cards == 0 then
                return
            end
            local card = Fk:getCardById(table.random(cards))
            room:obtainCard(player, card, true, fk.ReasonPrey, player, gloam_breath.name)
            room:setCardMark(card, "@@gloam_breath-inhand", 1)
        end,
        enabled_at_play = function(self, player)
            return player:hasSkill(gloam_breath.name) and player:usedEffectTimes(self.name, Player.HistoryPhase) < 1
        end
    })
    gloam_breath:addEffect("maxcards", {
        exclude_from = function(self, player, card)
            if player:hasSkill(gloam_breath.name) and card:getMark("@@gloam_breath-inhand") > 0 then
                return true
            end
        end,
        correct_func = function(self, player)
            if player:getMark("gloam_breath-phase") > 0 then
                local value = -2
                local limit = 2
                local result = math.max(player.hp, 0)
                local status_skills = Fk:currentRoom().status_skills[MaxCardsSkill] or Util.DummyTable
                local max_fixed = nil
                for _, skill in ipairs(status_skills) do
                    local f = skill:getFixed(player)
                    if f ~= nil then
                        max_fixed = max_fixed and math.max(max_fixed, f) or f
                    end
                end
                if max_fixed then result = math.max(max_fixed, 0) end
                for _, skill in ipairs(status_skills) do
                    if skill ~= self then
                        local c = skill:getCorrect(player)
                        result = result + (c or 0)
                    end
                end
                value = (result + value < limit) and (limit - result) or value
                return math.min(value, 0)
            end
        end,
    })
    gloam_breath:addEffect(fk.EventPhaseStart, {
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(gloam_breath.name) and player ~= target and target.phase == Player.Discard and target:getMark("gloam_breath-turn") == 0 and target:getMaxCards() > 2
        end,
        on_cost = function(self, event, target, player, data)
            return player.room:askToSkillInvoke(player, {
                skill_name = gloam_breath.name,
                prompt = "gloam_breath_prompt_discard::" .. target.id
            })
        end,
        on_use = function(self, event, target, player, data)
            player.room:setPlayerMark(target, "gloam_breath-phase", 1)
        end
    })
    gloam_breath:addEffect(fk.EventPhaseProceeding, {
        can_refresh = function(self, event, target, player, data)
            return target.phase == Player.Play
        end,
        on_refresh = function(self, event, target, player, data)
            target.room:setPlayerMark(target, "gloam_breath-turn", 1)
        end
    })

    local red_render = fk.CreateSkill {
        name = "red_render",
    }
    red_render:addEffect(fk.Damaged, {
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(red_render.name) and target == player
        end,
        on_cost = function(self, event, target, player, data)
            return player.room:askToSkillInvoke(player, {
                skill_name = red_render.name,
                prompt = "red_render_prompt1"
            })
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            room:drawCards(player, 2, red_render.name)
            if data.from and not data.from:isNude() and #table.filter(player:getCardIds("h"), function(id)
                    return Fk:getCardById(id).color == Card.Red
                end) > 0 then
                local max = #data.from:getCardIds("he")
                local discards = room:askToDiscard(player, {
                    min_num = 1,
                    max_num = max,
                    skill_name = red_render.name,
                    prompt = "red_render_prompt2",
                    pattern = ".|.|diamond,heart"
                })
                if #discards == 0 then
                    return
                end
                local cards = room:askToChooseCards(player, {
                    target = data.from,
                    min = #discards,
                    max = #discards,
                    skill_name = red_render.name,
                    flag = "he",
                    prompt = "red_render_prompt3::" .. data.from.id .. ":" .. #discards
                })
                room:throwCard(cards, red_render.name, data.from, player)
            end
        end
    })

    extension:loadSkillSkels { gloam_breath, red_render }
    hy_aki_shizuha:addSkills { "gloam_breath", "red_render" }

    Fk:loadTranslationTable {
        ["hy_aki_shizuha"] = "秋静叶",
        ["#hy_aki_shizuha"] = "秋日寂寞",
        ["illustrator:hy_aki_shizuha"] = "あお",
        ["designer:hy_aki_shizuha"] = "黑曜人形",
        ["cv:hy_aki_shizuha"] = "",

        ["gloam_breath"] = "暮息",
        [":gloam_breath"] = "出牌阶段限一次，你可以将一张♣牌当【乐不思蜀】使用，然后随机获得弃牌堆中一张红色牌，此牌不计入手牌上限。其他角色的弃牌阶段开始时，若其本回合未执行过出牌阶段，你可以令其本阶段手牌上限-2（至少为2）。",
        ["gloam_breath_prompt"] = "暮息：你可以将一张♣牌当【乐不思蜀】使用",
        ["@@gloam_breath-inhand"] = "暮息",
        ["gloam_breath_prompt_discard"] = "暮息：你可以令%dest本阶段手牌上限-2",

        ["red_render"] = "绯染",
        [":red_render"] = "在你受到伤害后，你可以摸两张牌，然后你可以弃置任意张红色手牌并弃置伤害来源等量张牌。",
        ["red_render_prompt1"] = "绯染：你可以摸两张牌",
        ["red_render_prompt2"] = "绯染：你可以弃置任意张红色手牌",
        ["red_render_prompt3"] = "绯染：弃置%dest%arg张牌",
    }
end
